using RedDotSystem;
using System.Collections.Generic;
using KissEcs;

public class RedDotMgr : NormalSingleton<RedDotMgr>
{
    public void AwakeLoad()
    {
        //Example
        RedDotTreeNode main_Patrol_Node = new() { node = RedDotDefine.Main_Patrol, logicHander = OnMain_Patrol_LogicHandler };

        RedDotSystem.RedDotSystem.Instance.InitlizateRedDotTree(new List<RedDotTreeNode>
        {
            main_Patrol_Node,
        });
    }

    /// <summary>
    /// 红点更新控制器
    /// </summary>
    /// <param name="node"></param>
    public void RedDotUpdateController(RedDotDefine node, bool state)
    {
        switch (node)
        {
            case RedDotDefine.Main_MoonCard_DailyIngotReward:
                ChangeNodeState(node, ref RedDotData.main_MoonCard_FreeDailyIngot_isCanClaim, state);
                break;
            case RedDotDefine.Main_MoonCard_MoonCardDailyIngot:
                ChangeNodeState(node, ref RedDotData.main_MoonCard_MoonCardDailyReward_isCanclaim, state);
                break;
            case RedDotDefine.Main_MoonCard_AdvMoonCardDailyIngot:
                ChangeNodeState(node, ref RedDotData.main_MoonCard_AdvMoonCardDailyReward_isCanClaim, state);
                break;
            case RedDotDefine.Main_MoonCard_YearCardDailyIngot:
                ChangeNodeState(node, ref RedDotData.main_MoonCard_yearCardDailyReward_isCanClaim, state);
                break;
            case RedDotDefine.Main_MoonCard_DoubleMoonCardAward:
                ChangeNodeState(node, ref RedDotData.main_MoonCard_doubleMoonCardReward_isCanclaim, state);
                break;
            case RedDotDefine.Main_Task_DailyAttendance:
                ChangeNodeState(node, ref RedDotData.main_Task_DailyAttendance_isCanAttend, state);
                break;
            case RedDotDefine.Main_ActiveTask:
                ChangeNodeState(node, ref RedDotData.main_Active_Task_isClaim, state);
                break;
            case RedDotDefine.Main_Task_Achievement:
                ChangeNodeState(node, ref RedDotData.main_Task_Achievement_isCanClaim, state);
                break;
            case RedDotDefine.Main_Task_DailyTask:
                ChangeNodeState(node, ref RedDotData.main_Task_DailyTask_isCanClaim, state);
                break;
            case RedDotDefine.Main_Task_WeeklyTask:
                ChangeNodeState(node, ref RedDotData.main_Task_WeeklyTask_isCanClaim, state);
                break;
            case RedDotDefine.Main_Mail:
                ChangeNodeState(node, ref RedDotData.main_Mail_hasUnreadMail, state);
                break;
            case RedDotDefine.Main_Patrol_QuickHangUp:
                ChangeNodeState(node, ref RedDotData.main_Patrol_QuickHangUp_isCanAttend, state);
                break;
            case RedDotDefine.Main_Patrol_Receive:
                ChangeNodeState(node, ref RedDotData.main_Patrol_isCanClaim, state);
                break;
            case RedDotDefine.Equip_Partner_Upgrade:
                ChangeNodeState(node, ref RedDotData.equip_Partner_CanUpgrade, state);
                break;
            case RedDotDefine.Equip_Partner_UpStar:
                ChangeNodeState(node, ref RedDotData.equip_Partner_CanUpStar, state);
                break;
            case RedDotDefine.Equip_Upgrade:
                ChangeNodeState(node, ref RedDotData.equip_EquipCanUpgrade, state);
                break;
            case RedDotDefine.Equip_Sysnthesis:
                ChangeNodeState(node, ref RedDotData.equip_Synthesis_equipCanSynthesis, state);
                break;
            case RedDotDefine.Shop_Chests_XbChestAds:
                ChangeNodeState(node, ref RedDotData.shop_XbChest_Ads_isCanBuy, state);
                break;
            case RedDotDefine.Shop_Chests_XbChestKey:
                ChangeNodeState(node, ref RedDotData.shop_XbChest_Key_isCanOpen, state);
                break;
            case RedDotDefine.Shop_Chests_XjChestAds:
                ChangeNodeState(node, ref RedDotData.shop_XjChest_Ads_isCanBuy, state);
                break;
            case RedDotDefine.Shop_Chests_XjChestKey:
                ChangeNodeState(node, ref RedDotData.shop_XjChest_Key_isCanOpen, state);
                break;
            case RedDotDefine.Shop_Shops_DailyIngots:
                ChangeNodeState(node, ref RedDotData.shop_DailyIngots_isCanBuy, state);
                break;
            case RedDotDefine.Main_FunctionPreview:
                ChangeNodeState(node, ref RedDotData.main_FunctionPriview_isCanClaim, state);
                break;
            case RedDotDefine.Talent:
                ChangeNodeState(node, ref RedDotData.talent_isCanBuy, state);
                break;
            case RedDotDefine.Main_DailyReward:
                ChangeNodeState(node, ref RedDotData.main_DailyReward_isCanClaim, state);
                break;
            case RedDotDefine.Main_Questionnaire:
                ChangeNodeState(node, ref RedDotData.main_Questionnaire_isNeedClick, state);
                break;
            case RedDotDefine.Main_FirstCharge:
                ChangeNodeState(node, ref RedDotData.main_FirstCharge_isNeedClicked, state);
                break;
            case RedDotDefine.Main_Fund:
                ChangeNodeState(node, ref RedDotData.main_Fund_isCanClaim, state);
                break;
            case RedDotDefine.Main_DailyDeal_DailyAds:
                ChangeNodeState(node, ref RedDotData.main_DailyDeal_dailyAds_isCanClaim, state);
                break;
            case RedDotDefine.Main_DailyDeal_WeeklyAds:
                ChangeNodeState(node, ref RedDotData.main_DailyDeal_weeklyAds_isCanClaim, state);
                break;
            case RedDotDefine.Main_DailyDeal_MonthlyAds:
                ChangeNodeState(node, ref RedDotData.main_DailyDeal_monthlyAds_isCanClaim, state);
                break;
            case RedDotDefine.Main_DailyReward_Ads:
                ChangeNodeState(node, ref RedDotData.main_DailyReward_isCanClaim, state);
                break;
            case RedDotDefine.Main_DailyReward_Share:
                ChangeNodeState(node, ref RedDotData.main_DailyReward_Share_isCanShare, state);
                break;
            case RedDotDefine.Main_RankList_Normal:
                ChangeNodeState(node, ref RedDotData.main_RankList_Normal_hasAward, state);
                break;
            case RedDotDefine.Main_RankList_Elite:
                ChangeNodeState(node, ref RedDotData.main_RankList_Elite_hasAward, state);
                break;
        }
    }

    /// <summary>
    /// 更新红点状态
    /// </summary>
    /// <param name="node"></param>
    public void CommonUpdateRedDotState(RedDotDefine node)
    {
        RedDotSystem.RedDotSystem.Instance.UpdateRedDotState(node);
    }

    public void ChangeNodeState(RedDotDefine node, ref bool data, bool state)
    {
        data = state;
        CommonUpdateRedDotState(node);
    }

    #region 分事件

    //Example
    public void OnMain_Patrol_LogicHandler(RedDotTreeNode redNode)
    {
        redNode.redDotActive = RedDotData.main_Patrol_isCanClaim;
    }

    public void OnLogicHandler(RedDotTreeNode redNode)
    {

    }
    #endregion
}
